This is mainly about the use of four examples: export (out), import (in), query Export (queryout), export format (-f) files.Example 1: Show sample database AdventureWorks entire table currency or view, using SQL connectionCopy CodeThe code is as follows: bcp AdventureWorks.sales.currency out c:\currency1.txt-c-u "sa"-P "password"--Use SQL connectionExample 2: ibid., using trusted connectionsCopy CodeThe code is as follows:
Document directory
2. 1. Export data from the table to a file (using trusted connections)
2. export data from the table to a file (using Hybrid Authentication)
2. 3. Import the data in the file to the table
0. References:
SQL Server BCP usage Summary
BCP Utility
How to import data from 6 million users to MySQL, MSSQL, and Oracle databases in a community
Select into and insert into select table copy sta
suffix BAT (a shell file is generated in UNIX and the corresponding execution permission is changed), which can be executed directly. That is, the corresponding data file is exported under the specified directory. The data of a table is a file. For example, in UNIX, the bat suffix is not required.
If you need to restore the data files backed up to the database again, you only need to replace the out parameter in the BCP command in the preceding opera
In this tutorial we introduce the tool--BCP utility for bulk data export import. It also introduces BULK INSERT import bulk data, and the practice of bcp combining BULK INSERT to do data interface (practice on SQL2008R2).1. Use of bcpThe BCP utility can bulk copy data between Microsoft SQL Server instances and data files in a user-specified format. Use the
Restore the qualified files of Location A to the machine of location B. The Administrator of the other party does not understand anything, so he wants to be a dumb as much as possible, so as not to explain to him how to perform the operation for half a day.
-- Export a text file using a query statement-- Exec master .. xp_cmdshell 'bcp "select * from [TestDB11-27] .. restoreweihai "queryout c: \ test.txt-F 2-C-s" 192.168.102.122 "-U" sa "-P" pass "'
-
DOS option jump implementation, dos + bcp double-click import and export data, bcp Import and Export
DOS option jump implementation, dos + bcp double-click import and export data
Option. bat
@echo off:Start2 clsgoto Start:Starttitle Frequently Used Websitesecho Please select a website from the listecho with the corresponding keyecho ------------------------
Tags: unexpected EOF bcpSenarioEnter sqlcmd with: Out XXX generate Data file, because sqlcmd export to file by default Chinese garbled, so with the-u (Unicode) switch@echo off setLocal enabledelayedexpansion:start@set db=adventureworks2012sqlcmd -d%db%-b-iscript.sql-v pa= "OUT.txt" pwd= "%cd%"-w-h-1timeout 3sqlcmd-d%db%-b-iout.txt-w-h-1-s^|-u--To this, Chinese normal displaySQLCMD ERRORStarting copy ... SQLState = S1000, NativeError = 0Error = [Microsoft][sql Server Native Client 11.0]unexpect
ObjectiveSQL Server provides a variety of different data export import tools, you can also write SQL scripts, use stored procedures, generate the required data files, and even can generate a script file containing SQL statements and data. Each has its advantages and disadvantages to suit different needs. The following is an introduction to the bulk data export tool--BCP utility. At the same time, the bulk INSERT import bulk data is also introduced, as
BCP is a command-line tool in SQL Server that is responsible for importing exported data, is based on db-library, and can efficiently import and export large quantities of data in a parallel manner. BCP can export a table or view of a database directly, or it can filter the table or view through a select from statement. When you import export data, you can use default values or use a format file to import d
Bcp is a command line tool used in SQL Server to import and export data. It is based on DB-Library and can efficiently import and export large batches of data in parallel. Bcp can be used to export tables or views of a database, or filter tables or views using the select from statement to export them. When importing and exporting data, you can use the default value or use a format file to import the data in
generated in UNIX and the corresponding execution permission is changed), which can be executed directly. That is, the corresponding data file is exported under the specified directory. The data of a table is a file. For example, in UNIX, the bat suffix is not required.
If you need to restore the data files backed up to the database again, you only need to replace the out parameter in the BCP command in the preceding operation
), which can be executed directly. That is, the corresponding data file is exported under the specified directory. The data of a table is a file. For example, in UNIX, the BAT suffix is not required.
If you need to restore the data files backed up to the database again, you only need to replace the out parameter in the BCP command in the preceding operation steps with the in parameter.
Note: You are advised
Original link: http://database.51cto.com/art/200701/37924.htm
BCP is a command line tool used in SQL Server to import and export data. It is based on DB-library and can efficiently import and export large batches of data in parallel. BCP can be used to export tables or views of a database, or filter tables or views using the select from statement to export them. When importing and exporting data, you can
execution permissions) to execute directly. That is, the corresponding data file is exported under the specified directory. The data for one table is a file. If you are under UNIX, you do not use a bat suffix.
If you need to revert back to the database for the backed-up data file, simply change the out parameter in the bcp command in the previous procedure to the in parameter.Note: It's a good idea to do some testing before you do the official data.
I checked the information online today and learned about BCP's simple transfer and transfer operations.
1. BCP is a database table-level data backup tool provided by Sybase. Therefore, it operates on tables.
2. Common statements are as follows:
Export table: BCP dbname .. tablename out C:/temp/filename-U sa-P password-s servername-C
Dbname database name; tablename table name;-u: Login Name;-P: Login Passwor
Server
bcp utility
The bcp utility replicates data in a user-specified format between the Microsoft®sql server™2000 instance and the data file.
Grammar
BCP {[database_name.] [owner].] {table_name | view_name} | "Query"}
{in | out | queryout | format} data_file
[M max_errors] [F Format_file] [-E Err_file]
[F First_row] [-L Last_row] [B batch_size]
[-N] [-c] [W] [
Tags: http ar uses SP for strong file data onBCP is a command-line tool in SQL Server that is responsible for importing and exporting data, is db-library-based, and can efficiently import and export large quantities of data in a parallel manner. BCP can export a table or view of a database directly, or you can filter a table or view by using the Select from statement. When importing and exporting data, you can use the default values or use a format fi
How to Use bcp to export data
1. Use bcp to export the entire table or view.
BCP adventureworks. Sales. Currency out c: \ currency1.txt-c-u "sa"-P "password" -- connect with a password
Or
BCP adventureworks. Sales. Currency out c: \ currency1.txt-c-t -- use a trusted connection
The output result after the precedi
---------------------------------------------------------------------------
---- This is andkylee's personal originality. Please repost it with respect to the author's Labor achievements;
---- The original source must be specified for reprinting.:Http://blog.csdn.net/andkylee
---2010-07-1111:39:25
---- Keyword: ase bcp -- initstring conditional data export
----------------------------------------------------------------------------
In versions earlier
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.